package org.supda.system.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * TResources entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_resources", catalog = "comsys")
public class TResources implements java.io.Serializable {

	// Fields

	private Long id;
	private String name;
	private Long parentId;
	private String resKey;
	private String type;
	private String buttonGroup;
	private Long bid;
	private String operate;
	private String style;
	private String resUrl;
	private Integer level;
	private String icon;
	private Integer ishide;
	private String description;
	private Short valid;
	private Set<TRole> TRoles = new HashSet<TRole>(0);

	// Constructors

	/** default constructor */
	public TResources() {
	}

	/** full constructor */
	public TResources(String name, Long parentId, String resKey,
			String type, String buttonGroup, String resUrl,
			Integer level, String icon, Integer ishide, String description,
			Set<TRole> TRoles) {
		this.name = name;
		this.parentId = parentId;
		this.resKey = resKey;
		this.type = type;
		this.buttonGroup = buttonGroup;
		this.resUrl = resUrl;
		this.level = level;
		this.icon = icon;
		this.ishide = ishide;
		this.description = description;
		this.TRoles = TRoles;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "parentId")
	public Long getParentId() {
		return this.parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	@Column(name = "resKey", length = 50)
	public String getResKey() {
		return this.resKey;
	}

	public void setResKey(String resKey) {
		this.resKey = resKey;
	}

	@Column(name = "type", length = 40)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "buttonGroup", length = 100)
	public String getButtonGroup() {
		return this.buttonGroup;
	}

	public void setButtonGroup(String buttonGroup) {
		this.buttonGroup = buttonGroup;
	}

	@Column(name = "resUrl", length = 200)
	public String getResUrl() {
		return this.resUrl;
	}

	public void setResUrl(String resUrl) {
		this.resUrl = resUrl;
	}

	@Column(name = "level")
	public Integer getLevel() {
		return this.level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	@Column(name = "icon", length = 100)
	public String getIcon() {
		return this.icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	@Column(name = "ishide")
	public Integer getIshide() {
		return this.ishide;
	}

	public void setIshide(Integer ishide) {
		this.ishide = ishide;
	}

	@Column(name = "description", length = 200)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TResourceses")
	public Set<TRole> getTRoles() {
		return this.TRoles;
	}

	public void setTRoles(Set<TRole> TRoles) {
		this.TRoles = TRoles;
	}

	@Column(name = "operate", length = 200)
	public String getOperate() {
		return operate;
	}

	public void setOperate(String operate) {
		this.operate = operate;
	}

	@Column(name = "style", length = 200)
	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	@Column(name = "bid")
	public Long getBid() {
		return bid;
	}

	public void setBid(Long bid) {
		this.bid = bid;
	}

	@Column(name = "valid", nullable = false)
	public Short getValid() {
		return valid;
	}

	public void setValid(Short valid) {
		this.valid = valid;
	}

}